

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
    <script src="jquery.min.js"></script>
</head>
<body>
     

<h1>login</h1>
<div>usernam:<input type="text" id="uid" ></input></div>
<div> &scap;</div>
<div>password:&nbsp;<input type="text" id="pwd" ></input></div>
<!-- <div><input type="button" value="login" id="btn"></input></div> -->
<button id="btn">login</button>
<button id="zhuce">zhuce</button>

<script>
    $(function(){

        $("#btn").click(function(){

            var uid = $("#uid").val();
            var pwd = $("#pwd").val();
            var data= {
                data: JSON.stringify({
                    'username': uid,
                    'password': pwd
                }),
            }
            $.ajax({

                url:"http://0.0.0.0:5000/login",

                data:data,

                type:"POST",
                
                dataType: 'json',
                success:function(res){
                    // console.log(res)
                    console.log(0)
                    window.location.href="html5-canvas-person-collision/index.html"; 
                    // alert(res.type)
                },
                error:function (res) {
                    console.log(res)
                    console.log(1)
                    alert('000000')
                }
                
                },

            );

        })
    });


    $(function(){

        $("#zhuce").click(function(){
            window.location.href='xc/index.html';
        });
    });

</script>
</body>

</html>